-
Notifications
You must be signed in to change notification settings - Fork 17.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bi-directional dshot on iomcu F103 #25197
Conversation
1d66140
to
66cac96
Compare
43c158b
to
8823946
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not complete review ... complex stuff!
7cf328e
to
9ad36a6
Compare
This has been refactored on top of #25315 in order to make the review easier. I have also where possible pulled functions out into RCOuput_iofirmware.cpp. This increases the copy and paste a little but makes the non-iofirmware bdshot codepaths much less changed |
9ad36a6
to
de3f649
Compare
de3f649
to
3ca182b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly needs testing now
e2df36b
to
60327d5
Compare
60327d5
to
d9719ea
Compare
494ad94
to
5ccf324
Compare
5ccf324
to
83ef89f
Compare
e65a413
to
8378585
Compare
prevent repeated rcout mode sets add ESC telemetry if compiled in add infrastructure to support propagating erpm and telemetry from iomcu add support to propagate bdmask to iomcu add support for EDT scale voltage and current correctly when reading EDT data ensure that telemetry data is reset reset ESC telemetry data to zero if stale ESC type and bdmask must be setup before the output mode
add direct accessor for telemetry data to be used by iomcu don't update telemetry data if no data
add support to tell if shared DMA channel is actually shared avoid starting and stopping the timer peripheral with bdshot ensure that rcout DMA allocation and deallocation happens entirely within the lock increase rcout thread working area for bdshot fix mode mask that is sent to the iomcu ensure iomcu rcout thread gets timeouts for callbacks control bdshot input and output line levels on f103 use input capture channel pairs to read rising and falling edges of telemetry on f103 reset channel pairs together on iomcu generalize the bdshot input path to support suitable buffer sizes for iomcu generalize DMAR reading of CCR registers to read two at a time on iomcu enable bi-directional dshot channels on PWM1-4 on iomcu add methods to directly access erpm values from rcout update erpm mask and esc telemetry correctly for firmware supporting dshot add support for propagating bdmask to iomcu dshot commands to all channels need to be aware of iomcu ensure esc type is propagated to iomcu cope with iomcu channel numbering when using EDT ensure pwm driver is reset properly for dshot commands on iomcu correctly reset pwm for dshot commands correctly mask off bdshot bits going to iomcu don't reset GPIO modes on disabled lines don't reset pwm_started when sharing DMA channels set thread name on iomcu rcout and reduce stack size on iomcu ensure that bdshot pulses with no response are handled correctly correctly setup DMA for input capture on f103 deal with out of order captured bytes when decoding bdshot telemetry ensure DMA sharing on f103 does not pull lines low only disable the timer peripheral when switching DMA channels on iomcu add support for waiting for _UP to finish before proceeding with dshot re-order iomcu dshot channels to let TIM4_UP go first ensure that a cascading event will always come when expected on rcout allow timeouts when using cascading dshot always rotate telemetry channel after trying to capture input cater for both in order and out-of-order bdshot telemetry packets cope with reversed packets when decoding bdshot telemetry ensure UP DMA channel is fully free on iomcu before starting next dshot cycle refactor rcout for iofirmware into separate file
remove unneeded packed attribute reset the PWM status after channels have been enabled or disabled
enabled shared_up_dma to be fully compiled out address some minor review comments
…nnels to 16 make ADC readings interrupt driven turn off iomcu updates when debugging allow for correct number of telemetry channels cycle between vservo and vrssi when reading adc build adc with O2
correct zero handling in bdshot decoding
don't look for multiple pages on single-page packets
…en IOMCU is present
8378585
to
710b4a1
Compare
This was tested by @timtuxworth at the weekend on plane on a Durandal with no issues found - thanks Tim |
This PR adds support for bdshot telemetry on iomcus using the F103. There is one limitation - only channels 1-4,7-8 support telemetry. It is not possible to support 5-6 as these share a DMA channel with the fast UART interconnect.
Support is built into the iomcu dshot variant so to use you simply need to set
BRD_IO_DSHOT
and supply the appropriateSERVO_BLH_BDMASK
. ESC telemetry indexes are modified to reflect the fact that ESC's 1-4 and 7-8 can now provide telemetry.EDT is working, so you can get temperature, current and voltage information from the ESCs using bdshot as well. To use set
SERVO_DSHOT_ESC
in the normal way.This PR also fixes a few bugs found in the iomcu dshot support:
This work was generously sponsored by Holybro and builds on the existing dshot work kindly sponsored by CubePilot.